package roshambo;

public class Score implements Comparable<Score> {

    private final String name;
    private final int points;
    private final int value;
    private final float time;

    /**
     *
     * @param name
     * @param points
     * @param value
     * @param time
     */
    public Score(String name, int points, int value, float time) {
        this.name = name;
        this.points = points;
        this.value = value;
        this.time = time;
    }

    /**
     *
     * @return
     */
    public String getName() {
        return name;
    }

    /**
     *
     * @return
     */
    public int getValue() {
        return value;
    }

    /**
     *
     * @return
     */
    public int getPoints() {
        return points;
    }

    /**
     *
     * @param s
     * @return
     */
    @Override
    public int compareTo(Score s) {
        //ordena em ordem decrescente
        if (value != s.value) {
            return -(int) Math.signum(value - s.value);
        }
        return -(int) Math.signum(points - s.points);

    }

    /**
     *
     * @return
     */
    @Override
    public String toString() {
        return name + " | points: " + points + " | score: "
                + value + " | time: " + time / 1000F + "s";
    }
}
